<template>
	<view>
		<el-dialog title="温馨提示" :visible.sync="dialogVisible" width="1000upx" :before-close="closeModel">
			<view class="text-bold text-xl">
				请从官网 www.home-for-researchers.com 登录工具，谢谢
			</view>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="closeModel()">确 定</el-button>
			</span>
		</el-dialog>
	</view>
</template>

<script>
	import { hrlogin } from '@/api/api.js';
	export default {
		data() {
			return {
				dialogVisible: false
			}
		},
		onLoad(options) {
			let that = this;
			if (options.tk) {
				hrlogin({
					code: options.tk
				}).then(res => {
					that.$store.commit('setToken', res.data.token)
					that.$store.commit('setUserInfo',res.data.userInfo)
					uni.setStorageSync('token', res.data.token);
					uni.setStorageSync('userInfo', res.data.userInfo);
					uni.reLaunch({
						url: "/pages/index/home"
					})
				})
			} else {
				this.dialogVisible = true;
			}
		},
		methods: {
			closeModel() {
				location.href="https://www.baidu.com";
			}
		}
	}
</script>

<style>

</style>
